import { Switch } from 'antd'
import globalConfig from '@/core/framework/config/globalConfig'

const SwitchDark = (props: any) => {
	const { setThemeConfig, themeConfig } = props
	const onChange = (checked: boolean) => {
		setThemeConfig({ ...themeConfig, isDark: checked })
	}

	return globalConfig.DarkThemeModeSwitchShowFlag ? (
		<Switch
			className="dark"
			defaultChecked={themeConfig.isDark}
			checkedChildren={<>🌞</>}
			unCheckedChildren={<>🌜</>}
			onChange={onChange}
		/>
	) : (
		<></>
	)
}

export default SwitchDark
